Q: Choose the correct properties of weak-heap.
Solution: This is the property of a weak heap.
Q: What is the other name of weak heap?
Solution: Relaxed heap is just another name of weak heap.
Q: What is the worst case time in searching minimum value in weak -heap?
Solution: Weak heap is an array based form that supports the operation of finding a minimum in O(1).
Q: The total comparisons in finding both smallest and largest elements are
Solution: The total comparisons in finding smallest and largest elements is n + ((n+1)/2) – 2.
Q: What is the complexity of given function of insertion. insert(int n) { if(buffer_size()< maxi_biffer_size()) buffer_aar[ind]==n; else move_to_heap(buffer,buffer+maxi_buffer_size()) }
Solution: Use a buffer array to store a fixed number of elements when the buffer is full the content of buffer is moved to heap.As a result the complexity is amotized O(1).
Q: The leaf node for a heap of height h will be at which position.
Solution: A complete binary tree is also a heap so by the property of binary tree the leaf nodes will be must at height h or h-1.
Q: The main distinguishable characterstic of a binomial heap from a binary heap is that
Solution: The main use of binomial heap is to unify two different heap efficiently.
Q: The number of trees in a binomial heap with n nodes is
Solution: At each depth there is a binomial tree in a binomial heap.
Q: In a binomial heap the root value is greater than left child and less than right child.
Solution: Binomial tree used in making binomial heap follows min heap property.
Q: Given the pseudo code, state whether the function for merging of two heap is correct or not? mergeTree(p,q) if p.root.value <= q.root.value return p.addTree(q) else return q.addTree(p)
Solution: Binomial heap has a property that root value is less than both the child node’s value. So the given function of merging two different heap is correct.
You Have Score    | /10 |